<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<body>
<script type="text/html" id="toolbarDemo">
	<div class="layui-btn-container">
		<button class="layui-btn layui-btn-sm" lay-event="add_panel">新增</button>
  	</div>
</script>
<script type="text/html" id="barDemo3">
  	<button class="layui-btn layui-btn-sm" lay-event="update_panel2">修改</button>
	<button class="layui-btn layui-btn-sm" lay-event="delete2">删除</button>
	<button class="layui-btn layui-btn-sm" lay-event="view2">显示</button>
	<button class="layui-btn layui-btn-sm" lay-event="reset">重置密码</button>
</script>
<script type="text/html" id="barDemo4">
  	<a href="#" lay-event="down">下载</a>
</script>
      <fieldset class="layui-elem-field layui-field-title site-title">
			<legend><a name="fixbar" style="font-size: 16px; color: #ce2424;">用户管理</a></legend>
		</fieldset>
		<form class="layui-form" action="save" id="myForm" method="post" lay-filter="stuform">
			<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">姓名：</label>
			<div class="layui-input-inline">
				<input type="text" name="name" value="${param.name}" class="layui-input" />
			</div>
				</div>
				<div class="layui-inline">
					<label class="layui-form-label">民族：</label>
				<div class="layui-input-inline">
					<input type="text" name="nation" value="${param.nation}" class="layui-input" />
				</div>
				</div>
				<%--  <div class="layui-inline">
					<label class="layui-form-label">政治面貌：</label>
				<div class="layui-input-inline">
					<input type="text" name="politics" value="${param.politics}" class="layui-input" />
				</div>
				</div>  --%>
				<div class="layui-inline">
					<button type="button" class="layui-btn layui-btn-danger" onclick="search()" >查询</button>
					<button type="button" class="layui-btn layui-btn-danger" onclick="empty()" >清空</button>
				</div>
			</div>
		</form>
      



	<table class="layui-hide" id="teacher" lay-filter="teacher"></table>
	 
	<script type="text/javascript">
		var option={
			elem:'#teacher',
			title:'课程信息',
			path:'teacher',
			height:'full-265',
			addurl:'edit',
			where:{name:'${param.name}',nation:'${param.nation}',politics:'${param.politics}'},
			toolbar:'#toolbarDemo',
			cols: [[
				{field: 'id', title: 'ID', hide: true, usersize: true, sort: true},
				{field: 'type', hide: true, title: '师资类型'},
				{field: 'name', title: '姓名'},
				{field: 'sex', title: '性别'},
				{field: 'nation', title: '民族'},
				{field: 'idcode', title: '身份证号'},
				{field: 'born', hide: true, title: '出生日期'},
				{field: 'politics', title: '政治面貌'},
				{field: 'degree', hide: true, title: '最高学历'},
				{field: 'speciality', hide: true, title: '专业'},
				{field: 'college', hide: true, title: '毕业院校'},
				{field: 'graduationdate', hide: true, title: '参加工作时间'},
				{field: 'teachingdate', hide: true, title: '执教时间'},
				{field: 'company', hide: true, title: '工作单位'},
				{field: 'job', title: '职务'},
				{field: 'title', hide: true, title: '职称'},
				{field: 'address', hide: true, title: '单位地址'},
				{field: 'phone', title: '手机'},
				{field: 'carnumber', hide: true, title: '车牌号'},
				{field: 'roleNames', title: '角色'},
				{field: 'card', title: '银行卡'},
				{field: 'title', hide: true, title: '职级职称'},
				{fixed: 'right', title:'职级职称', toolbar: '#barDemo4'},
				/* {field: 'curriculum', hide: true, title: '课程名称', templet: function(d){
					return d.curriculum?d.curriculum.courseName: '';
				}}, */
				{fixed: 'right', title:'操作', toolbar: '#barDemo3', width:280}
			]] 
		}
		var currRow="${param.currRow==null?'null':param.currRow}";
		var limit=${param.limit==null?'null':param.limit};
		var page=${param.page==null?'null':param.page};
		var classTable=new LayUiTable(option,currRow,limit,page);
		classTable.init();
		
	layui.use('table', function(){
	 var table = layui.table;
		table.on('tool(teacher)', function(obj) {
			var id = obj.data.id;
			var title = obj.data.title;
			if (obj.event === "reset") {
				layer.confirm('确认重置密码？', function(index) {
					$.post('teacher/reset', {
						id : id
					}, function(data) {
						layer.msg(data);
					});
				});
			}
			if(obj.event == "down"){
				if(title != null){
					window.location.href="coursewarev/download?id="+id;					
				}
			}
		});
	});
	function search(){
		classTable.search();
	}
	
	function empty(){
		classTable.empty();
	}
	</script>
</body>
